From e287537a027ffb7e2edeb9384ad933785e25d554 Mon Sep 17 00:00:00 2001 From: Arjen Hiemstra Date: Mon, 7 Apr 2025 17:26:11 +0200 Subject: [PATCH] [PATCH] controls: Fix link activation for text of InlineMessage Rather than stretching both the label and toolbar across the entire inline message, use implicit width for both, unless either would become larger than the InlineMessage width. Most importantly, since the toolbar only takes space that is not used by the text, this avoids links in the text not working correctly. BUG: 500578 Gbp-Pq: Name upstream_82abc769_controls-Fix-link-activation-for-text-of-InlineMessage.patch --- src/controls/templates/InlineMessage.qml | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/controls/templates/InlineMessage.qml b/src/controls/templates/InlineMessage.qml index 6781c43..ecf3b66 100644 --- a/src/controls/templates/InlineMessage.qml +++ b/src/controls/templates/InlineMessage.qml @@ -216,13 +216,9 @@ T.Control { Accessible.ignored: true - readonly property real remainingWidth: width - ( - icon.width - + label.anchors.leftMargin + label.implicitWidth + label.anchors.rightMargin - + (root.showCloseButton ? closeButton.width : 0) - ) + readonly property real fixedContentWidth: icon.width + Kirigami.Units.smallSpacing * 3 + (root.showCloseButton ? closeButton.width + Kirigami.Units.smallSpacing : 0) + readonly property real remainingWidth: width - fixedContentWidth - label.implicitWidth readonly property bool multiline: remainingWidth <= 0 || atBottom - readonly property bool atBottom: (root.actions.length > 0) && (label.lineCount > 1 || actionsLayout.implicitWidth > remainingWidth) Kirigami.Icon { @@ -302,11 +298,11 @@ T.Control { anchors { left: icon.right leftMargin: Kirigami.Units.largeSpacing - right: root.showCloseButton ? closeButton.left : parent.right - rightMargin: root.showCloseButton ? Kirigami.Units.smallSpacing : 0 top: parent.top } + width: Math.min(parent.width - parent.fixedContentWidth, implicitWidth) + color: Kirigami.Theme.textColor wrapMode: Text.WordWrap @@ -358,12 +354,13 @@ T.Control { alignment: Qt.AlignRight anchors { - left: parent.left top: contentLayout.atBottom ? label.bottom : parent.top topMargin: contentLayout.atBottom ? Kirigami.Units.largeSpacing : 0 right: (!contentLayout.atBottom && root.showCloseButton) ? closeButton.left : parent.right rightMargin: !contentLayout.atBottom && root.showCloseButton ? Kirigami.Units.smallSpacing : 0 } + + width: Math.min(implicitWidth, parent.width) } QQC2.ToolButton { -- 2.30.2